﻿@{
    ViewBag.Title = "回复管理 - " + ViewBag.DomainTitle;
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<table class="layui-table" lay-filter="dataTable" lay-data="{id:'dataTable',height:'full-0',method:'post',cellMinWidth:120,page:true,limit:20,url:'/Reply/AjaxData'}">
    <thead>
        <tr>
            <th lay-data="{field:'CreateTime'}">发布时间</th>
            <th lay-data="{field:'ArticleID'}">文章ID</th>
            <th lay-data="{field:'MemberID'}">发布人ID</th>
            <th lay-data="{field:'Content'}">内容</th>
            <th lay-data="{field:'Praise'}">赞</th>
            <th lay-data="{field:'Criticism'}">踩</th>
            <th lay-data="{field:'IsDisplayName'}">状态</th>
            <th lay-data="{field:'Remark'}">备注</th>
            <th lay-data="{fixed: 'right', width:150, align:'center', toolbar: '#tmpToolBar'}">操作</th>
        </tr>
    </thead>
</table>

<script type="text/html" id="tmpToolBar">
    {{# if(d.IsDisplay){ }}
    <a class="layui-btn layui-btn-xs layui-btn-danger" href="javascript:void(0)" onclick="javascript: { AjaxDisplay({{ d.ID }}); }">隐藏</a>
    {{# }else{ }}
    <a class="layui-btn layui-btn-xs" href="javascript:void(0)" onclick="javascript: { AjaxDisplay({{ d.ID }}); }">显示</a>
    {{# } }}
</script>

@Html.Partial("~/Views/Shared/_Script.cshtml")

<script>
    var table = layui.table;
    // 刷新table
    function tableReload() {
        table.reload('dataTable', { page: { curr: 1 } });
    };
    // 提交处理
    function AjaxDisplay(ids) {
        $.post('/Reply/AjaxDisplay', { ids: ids }, function (result) {
            layer.msg(result.msg);
            tableReload();
        });
    };
</script>